<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * class Term_lib
 * @author Davinder
 * @version 1.0
 */
 
class Term_lib
{
    private $_CI;
    private $_picture_config;
    
    public function __construct() {
        $this->_CI = & get_instance();
        log_message('ERROR',__CLASS__.' Class Initialized');
        $this->_CI->load->model('term_model');
	}
    
    public function terms_emojies($p_data=null) {
        
        $termData = $this->_CI->term_model->terms_emojies($p_data);
            
        if ( !empty($termData) ) {
            
            $newTermData = array();
            $i = 0;
            
            $this->_CI->config->load('scrapm');
            $scrapm_config = $this->_CI->config->item('scrapm');
            $sitepath = site_url().$scrapm_config['emoji_path'].'/';
            
            foreach ( $termData as $termDataElement ) {
                
                $newTermData[$i] = $termDataElement;
               
                $newTermData[$i]->emoji = (!empty($termDataElement->term_image)) ? $sitepath.$termDataElement->term_image : null;
                unset($termDataElement->term_image);
                $i++;
            }
            
            return $newTermData;
        } else {
            return FALSE;
        }
    }
}